package com.twu.biblioteca;

import static java.lang.String.format;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 8/25/13
 * Time: 10:59 AM
 * To change this template use File | Settings | File Templates.
 */
public class User {
    private String name;
    private String email;
    private String phoneNumber;
    private String username;
    private String password;
    private int libraryNumber;

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public User(String username, String password, String name, String email, String phoneNumber) {
        this.username = username;
        this.password = password;
        this.name = name;
        this.email = email;
        this.phoneNumber = phoneNumber;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getLibraryNumber() {

        return String.valueOf(libraryNumber).replaceFirst("(\\d{3})(\\d{4})", "$1-$2");
    }

    public void setLibraryNumber(int libraryNumber) {
        this.libraryNumber = libraryNumber;
    }

    @Override
    public String toString() {
        return format("%-15s %-15s %-10s", name, email, phoneNumber);
    }
}
